package com.medical.medicalmodulecommon.minio;

import io.minio.MinioClient;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Data
@Configuration
@ConfigurationProperties(prefix = "minio")
public class MinioConfig {

    private String url;
    private String username;
    private String password;
    private String bucketName;

    @Bean
    public MinioClient minioClient() {
        log.info("初始化MinIO客户端，地址: {}, 存储桶: {}", url, bucketName);
        return MinioClient.builder()
                .endpoint(url)
                .credentials(username, password)
                .build();
    }
}